home *** CD-ROM | disk | FTP | other *** search
- /*
- * VOR(oronoi)A(nalysis).H
- *
- */
-
- #ifndef _VORA_H_
- #define _VORA_H_
-
- #include "ip.h"
-
- #define SIGN(a) ( ((a) == 0.0) ? 0 : ( ((a) < 0.0) ? -1 : 1 ) )
- #define F_TO_INT(x) ( ((x)-(int)(x)<0.5) ? (int)(x) : (int)(x)+1 )
-
- /* define display AOI */
- #define ULX 0
- #define ULY 0
- #define LRX 511
- #define LRY 479
-
-
- /* define ``active'' AOI, excluding edge of display AOI */
- #define AULX 64
- #define AULY 64
- #define ALRX LRX-64
- /*#define ALRY LRY-64 */
- #define ALRY LRY-112 /* employ when parm displ in video inp */
-
-
- struct Pix {
- float x;
- float y;
- };
-
-
- struct Tuple {
- float x;
- float y;
- int index;
- };
-
-
- /* structure used both for sites and for vertices */
- struct vSite {
- struct Pix coord;
- int sitenbr;
-
- int nnn; /* coordination number */
- float *nnd; /* array of nn distances */
- int *nnsi; /* array contain ind of nn sites */
- unsigned int area; /* area of bubble domain occup site */
- unsigned int v_area; /* area of Vor poly, obt from vPoly */
-
- Boolean eFlag; /* mark site near AOI edge */
- Boolean aoiFlag; /* mark site out-of-bounds */
- /* 0: UnSet, 1: Set */
-
- Boolean status; /* status (0: InActive, 1: Active) */
- /* employed in kNN construction */
- };
-
-
-
- struct vEdge {
- int edgenbr;
- int vO, vF; /* indices of V. vertices delimiting edge */
- int sO, sF; /* indices of sites delimiting edge bisector */
- };
-
-
- struct vPoly {
- struct Pix coord;
- int sitenbr; /* Voronoi site interior to poly */
-
- int ne; /* number of poly edges ( == nof NN) */
- int *pei; /* index array of V. poly edges */
- float *vel; /* array of V. edge lengths */
-
- float *sphi; /* array of sin(a), angle a subt by V. edge */
-
- int *pvi; /* index array of poly vertices */
- float area;
-
- Boolean aoiFlag; /* mark poly if assoc site out-of-bounds */
- Boolean eFlag; /* mark poly if edge crosses AOI bounds */
- Boolean lFlag; /* mark polygon with ``vanishing'' edge len */
- };
-
-
- struct oHisto {
- int nh, nb; /* no input data, no histogram bins */
- float *phd; /* ptr to array of input data */
- float *ph; /* ptr to array of histogram data */
- float bw; /* bin width */
- float amin, amax;
- double mean, std_dev;
- };
-
-
- struct nnSite {
- /* struct Pix coord; */
- int sitenbr;
-
- Boolean status; /* status: InActive, Active */
- };
-
- struct kNNShell {
- int sitenbr; /* Site index */
- int kNN; /* nof NN shells (lists) constr for given Site */
- double frms; /* fractal measure, eval for given shell */
-
- double *aka; /* array of avrg areas of kNN domains */
-
- int tc; /* topol charge, c = n-6 */
- double *tctc; /* array of products, c(0)c(k)/nkNN */
-
- /* struct linklist *sha; *//* array of lists, repr k-NN shells */
- /* would be relevant for array vers */
- };
-
-
-
-
- /* function prototypes */
- /* xvora.c */
- extern void exitmess (char *prompt, int status);
- extern void fail_alloc (char *prompt, int status);
- #if defined(LINUX)
- extern int sycomp (struct vSite *s1, struct vSite *s2);
- #else
- extern int sycomp (const void *s1, const void *s2);
- #endif
- #if defined(LINUX)
- extern int sxcomp (struct vSite *s1, struct vSite *s2);
- extern int compare (float *t1, float *t2);
- #else
- extern int sxcomp (const void *s1, const void *s2);
- extern int compare (const void *t1, const void *t2);
- #endif
- extern void gprintf (FILE * fpOut, char *fmt,...);
- extern void main (int argc, char **argv);
- /* getopt.c */
- static void get_next_index (void);
- extern int getopt (int argc, char **argv, char *optstring);
- /* vora.c */
- extern struct Tuple *edge_mp (struct vSite *v1, struct vSite *v2, int index);
- #if defined(LINUX)
- extern int winding_ccwT (struct Tuple *r1, struct Tuple *r2);
- #else
- extern int winding_ccwT (const void *r1, const void *r2);
- #endif
- extern void sort_poly_edges (struct Tuple *pem,
- struct vSite *s, struct vPoly *p);
- #if defined(LINUX)
- extern int esO_comp (struct vEdge *e1, struct vEdge *e2);
- #else
- extern int esO_comp (const void *e1, const void *e2);
- #endif
- #if defined(LINUX)
- extern int esF_comp (struct vEdge *e1, struct vEdge *e2);
- #else
- extern int esF_comp (const void *e1, const void *e2);
- #endif
- extern double slen (struct vSite *v1, struct vSite *v2);
- extern int site_geom (struct vSite *s, struct vSite *v,
- struct vEdge *e, struct vPoly *p, int ns, int ne);
- #if defined(LINUX)
- extern int e_comp (struct vEdge *e1, struct vEdge *e2);
- #else
- extern int e_comp (const void *e1, const void *e2);
- #endif
- extern double T_area (struct vSite *v1, struct vSite *v2, struct vSite *v3);
- extern Boolean check_e (int e_vO, int e_vF);
- extern int *pe_dist (struct vPoly *p, int ns, int nel, int neu);
- extern void poly_geom (struct vSite *s, struct vSite *v, struct vEdge *e,
- struct vPoly *p, struct Tuple *pem, int ns, int ne, int CPV);
- extern void mark_eSites (struct vSite *s, int ns);
- extern void mark_eEdges (struct vSite *s, struct vEdge *e, int ne);
- extern Boolean check_s (struct vSite *s);
- extern int *count_defects (struct vSite *s, int ns, int ncl, int ncu);
- extern Boolean check_v (struct vSite *v);
- extern void site_coordination (struct vSite *s, struct vSite *v,
- struct vEdge *e, int ns, int ne);
- extern double p_of_nVA (int *ndn, unsigned int **a_n, int ns, struct vPoly *p);
-
- /* hist.c */
- extern double find_mean (float *data, int n);
- extern double find_sigma (float *data, int n, double mean);
- extern void construct_hist (int n, float *data, float *hist,
- double bw, double data_base);
- extern void construct_shist (int n, float *data, float *hist,
- double bw, double data_base);
- /* ds.c */
- extern double a_union (double rd, struct vSite *s, int ns);
- extern void eval_p (struct vSite *s,
- int ns, struct Tuple *pf, int npf, double r0, double area);
- extern void eval_q (float *hist, struct Tuple *qf, int nqf, double r0);
- /* knns.c */
- extern float eval_mn (struct vSite *vS, struct vSite *vsa);
- extern int m_of_n (int *idn, float **m_n, int ns, struct vSite *vsa);
- extern void eval_aka (struct vSite *vsa, int kNN, double *aka,
- struct linklist *sha);
- extern int eval_tctc (struct vSite *vsa, int kNN, double *tctc,
- struct linklist *sha);
- extern double eval_frms (int kNN, struct linklist *sha);
- extern int cmpSiteInd (struct nnSite *oldSite, struct nnSite *newSite);
- extern void init_sk (struct linklist *knnsll);
- extern Boolean scanSiteInd (struct nnSite *newSite, struct linklist *list);
- extern void expand_kNN_list (struct nnSite *nnnS, struct linklist *list);
- extern void contract_kNN_list (struct linklist *list);
- extern void show_kNN_list (struct linklist *list, int k);
- extern double xak_kNN_list (struct vSite *vsa, struct linklist *list, int k);
- extern double xck_kNN_list (struct vSite *vsa, struct linklist *list, int k);
- extern double xc0 (struct vSite *vsa, struct linklist *list);
- extern void init_sk0 (struct vSite *vsa, int sitenbr, struct linklist *list);
- extern void SetActive (struct vSite *vsa, int ns);
- extern struct linklist *kNNs (struct vSite *vsa, struct linklist *plist,
- struct linklist *clist, int k);
- extern double construct_kNNs (int ns, struct vSite *vsa,
- struct linklist *sha, struct kNNShell *sk);
- #if 0
- /* in vora_io.c */
- extern void write_hdt_data (FILE * fpOut, int n_parms, float *foo,
- struct Histo *h, struct Tuple *ds, int nd);
- extern void log_st_data (FILE * fpOut, char *wbuf, int ns,
- struct vSite *s);
- extern void log_pt_data (FILE * fpOut, char *wbuf, int ns,
- struct vPoly *p, struct vEdge *e, struct vSite *v, int CPV);
- extern void dump_poly_vc (FILE * fpOut, int ns, struct vPoly *p,
- struct vSite *v);
- #endif
-
- #endif /* _VORA_H_ */
-